package com.whh.zuowen.count.publisher;

import com.whh.zuowen.count.event.ZuowenCountEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class ZuowenCountEventPublisher {

    @Autowired
    ApplicationEventPublisher applicationEventPublisher;

    public void publishCustomEvent(final Integer id) {
        System.out.println("Publishing custom event. ");
        ZuowenCountEvent customSpringEvent = new ZuowenCountEvent(this, id);
        applicationEventPublisher.publishEvent(customSpringEvent);
    }
}
